import React from 'react';
import * as PropTypes from 'prop-types'

import {Util} from '..';
import {MapContext} from '../Context';
import * as controlFactory from 'ol/control';

class Attribution extends React.Component {
  static defaultProps = {

  };
  constructor(props) {
    super(props);
    this.state = {

    };
    this.options = {
      className: undefined,
      target: undefined,
      collapsible: undefined,
      collapsed: undefined,
      tipLabel: undefined,
      label: undefined,
      collapseLabel: undefined,
      render: undefined
    }
    this.control = new controlFactory.Attribution()
  }

  componentDidMount() {
    this.init();
  }
  init = () => {
    Util.updateOptions(this.options,this.props)
    this.control = new controlFactory.Attribution(this.options)
    this.context.mapComp.controls.push(this.control)
  };

  render() {
    return null;
  }
}
Attribution.propTypes = {

}
Attribution.contextType = MapContext;
export default Attribution;

